# 现将学生名单复制进yf.txt,再开始运行哈
import random

x = open("yf.txt", "r", encoding="UTF-8")
y = x.read()
namelist = y.split('\n')
a = '1'
while a == '1':
    b = random.choice(namelist)
    namelist.remove(b)  # 点过名的不会再被点到
    print('就是你啦：%s'%b)  # 输出点到名的同学的名字
    f = open("red.txt", "a", encoding="UTF-8")
    f.write(b)
    f.write('\n')
    f.close()
    # print("计科1814-39-易芳")
    if not namelist:
        print("点名结束")
        break
    else:
        with open("yf.txt", "w", encoding="utf-8") as f_w:
            for line in namelist:
                f_w.write(line)
                f_w.write('\n')
        a = input("是否继续点名[1继续/0结束]")
        while a != '1' and a != '0':
            a = input("请输入正确选项[0或1]")


